export const searchProps = [
  {
    type: 'input',
    value: 'institutionName',
    name: '机构名称',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
  {
    type: 'input',
    value: 'planName',
    name: '计划名称',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
  {
    type: 'select',
    value: 'status',
    name: '状态',
    selectOptions: [
      {
        label: '开启',
        value: 0,
      },
      {
        label: '关闭',
        value: 1,
      },
    ],
    placeholder: '请选择',
    style: {
      width: '180px',
    },
  },
];

const typeMap1 = {
  1: 'API',
  2: 'CRM',
};

export const columns = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 70,
    customRender: (text, record, index) => `${index + 1}`,
  },
  {
    dataIndex: 'institutionName',
    title: '机构名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'type',
    title: '机构类型',
    ellipsis: true,
    width: 100,
    customRender: (text) => typeMap1[text] || '/',
  },
  {
    dataIndex: 'planName',
    title: '计划名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'time',
    title: '跑量时间',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'time' },
  },
  {
    dataIndex: 'weight',
    title: '权重',
    ellipsis: true,
    width: 80,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'dayPush',
    title: '当日投放数量',
    ellipsis: true,
    width: 120,
    customRender: (text) => text === 0 ? 0 : (text || '/'),
  },
  {
    dataIndex: 'totalPush',
    title: '全部投放量',
    ellipsis: true,
    width: 120,
    customRender: (text) => text === 0 ? 0 : (text || '/'),
  },
  {
    dataIndex: 'dayQuantity',
    title: '限制投放量',
    ellipsis: true,
    width: 120,
    customRender: (text) => text === 0 ? 0 : (text || '/'),
  },
  {
    dataIndex: 'status',
    title: '启用状态',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'status' },
  },
  {
    dataIndex: 'risk',
    title: '雷达状态',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'risk' },
  },
  {
    title: '操作',
    width: 280,
    align: 'center',
    fixed: 'right',
    dataIndex: 'operation',
    scopedSlots: {
      customRender: 'operation',
    },
  },
];

export const searchProps1 = [
  {
    type: 'input',
    value: 'provinceName',
    name: '省份',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
  {
    type: 'input',
    value: 'cityName',
    name: '城市',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
];

export const columns1 = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 70,
    align: 'center',
    customRender: (text, record, index) => `${index + 1}`,
  },
  {
    dataIndex: 'provinceCode',
    title: '省编码',
    ellipsis: true,
    align: 'center',
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'provinceName',
    title: '省名称',
    align: 'center',
    ellipsis: true,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'cityCode',
    title: '市编码',
    align: 'center',
    ellipsis: true,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'cityName',
    title: '市名称',
    align: 'center',
    ellipsis: true,
    customRender: (text) => text || '/',
  },
  {
    title: '操作',
    align: 'center',
    width: 120,
    scopedSlots: {
      customRender: 'operation',
    },
  },
];

export const searchProps2 = [
  {
    type: 'input',
    value: 'provinceName',
    name: '省份',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
  {
    type: 'input',
    value: 'cityName',
    name: '城市',
    style: {
      width: '180px',
    },
    placeholder: '请输入',
  },
];

const preventMap = {
  0: '屏蔽',
  1: '开通',
};

export const columns2 = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 70,
    align: 'center',
    customRender: (text, record, index) => `${index + 1}`,
  },
  {
    dataIndex: 'provinceName',
    title: '省名称',
    ellipsis: true,
    align: 'center',
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'cityName',
    title: '市名称',
    ellipsis: true,
    align: 'center',
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'price',
    title: '单价',
    align: 'center',
    ellipsis: true,
    customRender: (text) => text === 0 ? 0 : (text || '/'),
  },
  {
    dataIndex: 'prevent',
    title: '类型',
    align: 'center',
    ellipsis: true,
    customRender: (text) => preventMap[text] || '/',
  },
  {
    title: '操作',
    align: 'center',
    scopedSlots: {
      customRender: 'operation',
    },
  },
];
